package me.healthcare.event;

import me.healthcare.app.R;
import android.app.Activity;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

public class RegisterActivity_Events {
	public static void closeActivity(Activity activity) {
		// Closing current screen
		// Switching back to previous screen
		activity.finish();
	}

	public static void switchRole(Activity activity, int checkedId) {
		// switching content base on radio button
		TextView deviceIdText = (TextView) activity
				.findViewById(R.id.reg_device_id_label);
		EditText deviceId = (EditText) activity
				.findViewById(R.id.reg_device_id);
		TextView doctorIdText = (TextView) activity
				.findViewById(R.id.reg_doctor_id_label);
		EditText doctorId = (EditText) activity
				.findViewById(R.id.reg_doctor_id);

		if (checkedId == R.id.radioNguoiDung) {
			deviceIdText.setVisibility(View.VISIBLE);
			deviceId.setVisibility(View.VISIBLE);
			doctorIdText.setVisibility(View.GONE);
			doctorId.setVisibility(View.GONE);
		} else if (checkedId == R.id.radioBacSi) {
			deviceIdText.setVisibility(View.GONE);
			deviceId.setVisibility(View.GONE);
			doctorIdText.setVisibility(View.VISIBLE);
			doctorId.setVisibility(View.VISIBLE);
		}
	}

	public static void register(Activity activity) {
		// TODO validate inputs, check conflict data, save new user on server
		// and response.
		Toast.makeText(activity, "Not available yet!", Toast.LENGTH_SHORT)
				.show();
	}
}
